package org.wlc.demov1Impl;

import com.wlc.util.JsonResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wlc.demov1.MinibusTargetService;

/**
 * @author 王立朝
 * @date 2022/5/12
 * @description:
 */
public class LotteryServiceImpl implements LotteryService{
    private Logger logger = LoggerFactory.getLogger(LotteryServiceImpl.class);

    private MinibusTargetService minibusTargetService = new MinibusTargetService();
    /**
     * @param uid
     * @return
     */
    @Override
    public JsonResult doDraw(String uid) {
        // 1、摇号
        String lottery = minibusTargetService.lottery(uid);
        // 2、发短信
        logger.info("给用户{} 发送短信通知（短信）：{}",uid,lottery);
        // 3、发MQ消息
        logger.info("记录用户{}摇号结果(MQ){}",uid,lottery);
        // 4、结果
        return new JsonResult().success(uid,lottery);
    }
}
